package main

const Borderwidth = 4

const (
	DOpaque        uint = 0xFFFFFFFF
	DTransparent   uint = 0x00000000
	DBlack         uint = 0x000000FF
	DWhite         uint = 0xFFFFFFFF
	DRed           uint = 0xFF0000FF
	DGreen         uint = 0x00FF00FF
	DBlue          uint = 0x0000FFFF
	DCyan          uint = 0x00FFFFFF
	DMagenta       uint = 0xFF00FFFF
	DYellow        uint = 0xFFFF00FF
	DPaleyellow    uint = 0xFFFFAAFF
	DDarkyellow    uint = 0xEEEE9EFF
	DDarkgreen     uint = 0x448844FF
	DPalegreen     uint = 0xAAFFAAFF
	DMedgreen      uint = 0x88CC88FF
	DDarkblue      uint = 0x000055FF
	DPalebluegreen uint = 0xAAFFFFFF
	DPaleblue      uint = 0x0000BBFF
	DBluegreen     uint = 0x008888FF
	DGreygreen     uint = 0x55AAAAFF
	DPalegreygreen uint = 0x9EEEEEFF
	DYellowgreen   uint = 0x99994CFF
	DMedblue       uint = 0x000099FF
	DGreyblue      uint = 0x005DBBFF
	DPalegreyblue  uint = 0x4993DDFF
	DPurpleblue    uint = 0x8888CCFF

	DNotacolor uint = 0xFFFFFF00
	DNofill    uint = DNotacolor
)

// image channel descriptors
const (
	CRed = iota
	CGreen
	CBlue
	CGrey
	CAlpha
	CMap
	CIgnore
	NChan
)

func dc(_type, nbits uint) uint {
	return ((_type & 15) << 4) | (nbits & 15)
}
func chan1(a, b uint) uint {
	return dc(a, b)
}
func chan2(a, b, c, d uint) uint {
	return chan1(a, b)<<8 | dc(c, d)
}
func chan3(a, b, c, d, e, f uint) uint {
	return chan2(a, b, c, d)<<8 | dc(e, f)
}
func chan4(a, b, c, d, e, f, g, h uint) uint {
	return chan3(a, b, c, d, e, f)<<8 | dc(g, h)
}

var (
	GREY1  uint = chan1(CGrey, 1)
	GREY2  uint = chan1(CGrey, 2)
	GREY4  uint = chan1(CGrey, 4)
	GREY8  uint = chan1(CGrey, 8)
	CMAP8  uint = chan1(CMap, 8)
	RGB15  uint = chan4(CIgnore, 1, CRed, 5, CGreen, 5, CBlue, 5)
	RGB16  uint = chan3(CRed, 5, CGreen, 6, CBlue, 5)
	RGB24  uint = chan3(CRed, 8, CGreen, 8, CBlue, 8)
	RGBA32 uint = chan4(CRed, 8, CGreen, 8, CBlue, 8, CAlpha, 8)
	ARGB32 uint = chan4(CAlpha, 8, CRed, 8, CGreen, 8, CBlue, 8) // stupid VGAs
	XRGB32 uint = chan4(CIgnore, 8, CRed, 8, CGreen, 8, CBlue, 8)
	BGR24  uint = chan3(CBlue, 8, CGreen, 8, CRed, 8)
	ABGR32 uint = chan4(CAlpha, 8, CBlue, 8, CGreen, 8, CRed, 8)
	XBGR32 uint = chan4(CIgnore, 8, CBlue, 8, CGreen, 8, CRed, 8)
)

// line ends
const (
	Endsquare = iota
	Enddisc
	Endarrow
	Endmask = 0x1F
)
